package com.zhu.responder.websocker.config;

import com.zhu.responder.websocker.handler.ChannelPool;
import com.zhu.responder.websocker.handler.MyNettyServerHandler;
import com.zhu.responder.websocker.netty.NettyServer;
import com.zhu.responder.websocker.netty.NettyServerApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class WebSocketConfig {
 
    @Bean
    public NettyServer nettyServer(){
        return new NettyServer(myNettyServerHandler());
    }

    @Bean
    public MyNettyServerHandler myNettyServerHandler(){
        return new MyNettyServerHandler(ChannelPool.channels);
    }

    @Bean
    public NettyServerApplication nettyServerApplication(){
        return new NettyServerApplication(nettyServer());
    }
}